//package com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.data;
//
//import com.inspur.edp.cef.gencommon.ReflectionUtils;
//import com.inspur.edp.cef.generator.common.MediatePropertyInfo;
//import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.property.BaseTypePropGenerator;
//import com.inspur.edp.cef.variable.api.attr.SessionVarAttribute;
//import com.inspur.edp.cef.variable.core.data.DataUtil;
//import org.eclipse.jdt.core.dom.Block;
//import org.eclipse.jdt.core.dom.MethodInvocation;
//import org.eclipse.jdt.core.dom.ReturnStatement;
//import org.eclipse.jdt.core.dom.StringLiteral;
//
////来自session的变量, 根据20190216讨论, 直接从session上取值赋值, 不支持回滚
//public class SessionDataPropGenerator extends BaseTypePropGenerator
//{
//	private String sessionKey;
//
//	public SessionDataPropGenerator(MediatePropertyInfo propertyInfo, String propertyFieldName)
//	{
//		super(propertyInfo,propertyFieldName);
//	}
//
//	@Override
//	protected void beforeInitialize()
//	{
//		super.beforeInitialize();
//		SessionVarAttribute attr = (SessionVarAttribute) ReflectionUtils.getMethodAnnotation(getPropertyInfo().getPropertyMethod(),SessionVarAttribute.class);
//		sessionKey = attr.sessionKey();
//	}
//
//	@Override
//	protected Block buildGetMethodBody() {
//		Block block=ast.newBlock();
//		ReturnStatement returnStatement=ast.newReturnStatement();
//		MethodInvocation methodInvocation=ast.newMethodInvocation();
//		addImport(DataUtil.class.getTypeName());
//		methodInvocation.setExpression(ast.newSimpleName("DataUtil"));
//		methodInvocation.setName(ast.newSimpleName("getSesssionValue"));
//		StringLiteral stringLiteral=ast.newStringLiteral();
//		stringLiteral.setLiteralValue(sessionKey);
//		methodInvocation.arguments().add(stringLiteral);
//		returnStatement.setExpression(methodInvocation);
//
//		block.statements().add(returnStatement);
//		return block;
//	}
//
//	@Override
//	protected Block buildSetMethodBody() {
//		Block block=ast.newBlock();
//		ReturnStatement returnStatement=ast.newReturnStatement();
//		MethodInvocation methodInvocation=ast.newMethodInvocation();
//		addImport(DataUtil.class.getTypeName());
//		methodInvocation.setExpression(ast.newSimpleName("DataUtil"));
//		methodInvocation.setName(ast.newSimpleName("setSessionValue"));
//		StringLiteral stringLiteral=ast.newStringLiteral();
//		stringLiteral.setLiteralValue(sessionKey);
//		methodInvocation.arguments().add(stringLiteral);
//		methodInvocation.arguments().add(ast.newSimpleName("value"));
//		returnStatement.setExpression(methodInvocation);
//
//		block.statements().add(returnStatement);
//		return block;
//	}
//
//}